s = dir('c:\manoj\projects\ace\ler\monthly\');

st=1;
for i = 1:72,
[data1,err] = obs_read(['c:\manoj\projects\ace\ler\monthly\' s(i+2).name],'X');
if err == 0, 
    display(s(i+2).name); 
    [data2,err] = obs_read(['c:\manoj\projects\ace\ler\monthly\' s(i+2).name],'Y');
    data = data1;
    data(:,5:end) = sqrt(data1(:,5:end).^2+data2(:,5:end).^2);
    LER(st:st+size(data,1)-1,:) = data;
    st=st+size(data,1); 
end;
end;

LER_TS = reshape(LER(:,5:end)',[1,52608*60]);
L = LER_TS>99999;
LER_TS(L) = NaN;

LERH = reshape(LER(:,5:end)',[24*60,2192]);
L = LERH>99999;
LERH(L) = NaN;
fday_ler = [0:2191];
base = repmat(mean(LERH(60:160,:))',[1,1440])';
LERH_dH = LERH-base;


s = dir('c:\manoj\projects\ace\esk\monthly\');

st=1;
for i = 1:72,
[data1,err] = obs_read(['c:\manoj\projects\ace\esk\monthly\' s(i+2).name],'X');
if err == 0, 
    display(s(i+2).name); 
    [data2,err] = obs_read(['c:\manoj\projects\ace\esk\monthly\' s(i+2).name],'Y');
    data = data1;
    data(:,5:end) = sqrt(data1(:,5:end).^2+data2(:,5:end).^2);
    ESK(st:st+size(data,1)-1,:) = data;
    st=st+size(data,1); 
end;
end;

ESK_TS = reshape(ESK(:,5:end)',[1,52608*60]);
L = ESK_TS>99999;
ESK_TS(L) = NaN;


FILT_ESK(1:653+1440) = []; %first data is 2000/01/02/ 00:00:30
FILT_LER(1:653+1440) = [];

FILT_ESK(end-786:end) = [];%last day is 2005/12/30 23:59:30
FILT_LER(end-786:end) = [];


fday_esk_ler_ts_filt = (datenum(2000,1,2,0,0,30):(60/(24*3600)):datenum(2005,12,30,23,59,30))-datenum(2000,1,1);
fday_esk_ler_ts = (datenum(2000,1,1,0,0,30):(60/(24*3600)):datenum(2005,12,31,23,59,30))-datenum(2000,1,1);



ESKH = reshape(ESK(:,5:end)',[24*60,2192]);
L = ESKH>99999;
ESKH(L) = NaN;
fday_esk = [0:2191];
base = repmat(mean(ESKH(60:160,:))',[1,1440])';
ESKH_dH = ESKH-base;



